{php $CSS = array('extend');}
{template 'header'}
<div class="m">
	<table cellpadding="0" cellspacing="0" width="100%">
	<tr>
	<td valign="top" class="left_menu">
		<ul>
		<li class="left_menu_li"><a href="{$MODULE[1][linkurl]}">网站首页</a></li>
		<li class="left_menu_li" id="type_0"><a href="{$url}">积分换礼</a></li>
		<li class="left_menu_li" id="type_my"><a href="{$url}index.php?action=my">我的订单</a></li>
		{loop $_TP[0] $v0}
		<li class="left_menu_li" id="type_{$v0[typeid]}"><a href="{$url}{list_url($v0[typeid])}">{$v0[typename]}</a></li>
			{if isset($_TP[1][$v0[typeid]])}
			{loop $_TP[1][$v0[typeid]] $v1}
			<li class="left_menu_li" id="type_{$v1[typeid]}"><a href="{$url}{list_url($v1[typeid])}">&nbsp;|- {$v1[typename]}</a></li>
			{/loop}
			{/if}
		{/loop}
		</ul>
	</td>
	<td width="8"> </td>
	<td valign="top">
		<div class="left_box">		
			<div class="pos">
			<span class="f_r">
			<form action="{$url}index.php">
			<input type="text" name="kw" size="20" value="{if $kw}{$kw}{else}关键词{/if}" onfocus="if(this.value=='关键词')this.value='';" id="gift_kw"/>&nbsp;
			<input type="submit" value=" 搜索 " onclick="if(Dd('gift_kw').value=='关键词' || Dd('gift_kw').value.length<2){Dd('gift_kw').focus();return false;}"/>
			<input type="button" value=" 重搜 " onclick="Go('{$url}');"/>
			</form>
			</span>
			当前位置: <a href="{$MODULE[1][linkurl]}">首页</a> &raquo; <a href="{$url}">积分换礼</a>{if $typeid} &raquo; <a href="{$url}{list_url($typeid)}">{$TYPE[$typeid][typename]}</a>{/if}
			</div>
			{if $action == 'my'}
				<div class="b15">&nbsp;</div>
				<table cellpadding="6" cellspacing="1" width="96%" align="center" bgcolor="#E3EEF5">
				<tr bgcolor="#F1F7FC">
				<th>订单编号</th>
				<th>礼品</th>
				<th>{$DT[credit_name]}</th>
				<th>下单时间</th>
				<th>状态</th>
				</tr>
				{loop $lists $k $v}
				<tr align="center" bgcolor="#FFFFFF">
				<td>{$v[oid]}</td>
				<td><a href="{$v[linkurl]}" target="_blank">{$v[title]}</a></td>
				<td>{$v[credit]}</td>
				<td>{$v[adddate]}</td>
				<td>{$v[status]}</td>
				</tr>
				{/loop}
				</table>
				<div class="pages">{$pages}</div>
				<div class="b10">&nbsp;</div>
				<script type="text/javascript">try{Dd('type_my').className='left_menu_on';}catch(e){}</script>
			{else}
				{if $itemid}
				{if isset($success)}
					<div class="submit_success">
					恭喜您，礼品兑换成功！请检查您的联系方式是否正确，以便工作人员与您取得联系&nbsp;&nbsp;
					<a href="{$MODULE[2][linkurl]}edit.php" target="_blank">[更新联系方式]</a>
					<a href="{$url}index.php?action=my">[查看订单]</a>
					</div>
				{/if}
				<div class="g_info">			
					<table cellpadding="3" cellspacing="3" width="98%" align="center">
					<tr>
					<td width="180" valign="top">
					<img src="{$middle}" width="160" alt="{$title}" class="g_img c_p" alt="{$title}" title="点击查看大图" onclick="View('{$thumb}');"/>
					</td>
					<td valign="top" width="360">
					<ul>
					<li><strong class="px14">{$title}</strong></li>
					<li>浏览次数：{$hits}</li>
					<li>会员权限：{if $gname}{$gname}{else}全部{/if}</li>
					<li>当前状态：{if $left}<img src="{DT_STATIC}file/image/process_{get_process($fromtime, $totime)}.gif" align="absmiddle" alt="有效期：{$fromdate} 至 {$todate}"/>{else}<span class="f_red">已结束</span>{/if}</li>
					</ul>
					</td>
					<td valign="top">
					<ul>
					<li>发布时间：{$adddate}</li>
					<li>所需{$DT[credit_name]}：<strong class="f_red">{$credit}</strong></li>
					<li>剩余名额：<strong>{$left}</strong></li>
					<li><img src="{DT_SKIN}image/btn_gift.gif" alt="立即兑换" class="c_p" onclick="Order();"/></a></li>
					</ul>
					</td>
					</tr>
					</table>			
				</div>
				{if $content}<div class="pd20 lh18 px13">{$content}</div>{else}&nbsp;{/if}
				<script type="text/javascript">
				function Order() {
					{if $process == 1}return confirm('抱歉，此兑换还没有开始');{/if}
					{if $process == 2}if(confirm('确定要兑换吗？系统将扣除您{$credit}{$DT[credit_name]}')) Go('{$url}index.php?action=order&itemid={$itemid}'){/if}
					{if $process == 3}return confirm('抱歉，此兑换已经过期');{/if}
					{if $process == 4}return confirm('抱歉，此兑换名额用尽，已经结束');{/if}
				}
				</script>
				{else}
				<div class="b10"></div>
				<table cellpadding="3" cellspacing="3" width="98%" align="center">
				{loop $lists $k $v}
				{if $k%4==0}<tr align="center">{/if}
				<td width="25%" valign="top">
				<div class="thumb">
					<a href="{$v[linkurl]}"><img src="{$v[thumb]}" width="100" alt="{$v[alt]}"/></a>
					<ul>
					<li><a href="{$v[linkurl]}">{$v[title]}</a></li>
					<li><strong class="f_red">{$v[credit]}</strong> {$DT[credit_name]}</li>
					<li>剩余 <span class="f_gray">{$v[left]}</span> 个名额</li>
					<li style="padding:5px 0 5px 0;"><a href="{$v[linkurl]}"><img src="{DT_SKIN}image/btn_gift.gif" alt="立即兑换" style="border:none;"/></a></li>
					</ul>
				</div>
				</td>
				{if $k%4==3}</tr>{/if}
				{/loop}
				</table>
				<div class="pages">{$pages}</div>
				{/if}
				<script type="text/javascript">try{Dd('type_{$typeid}').className='left_menu_on';}catch(e){}</script>
			{/if}
		</div>
	</td>
	</tr>
	</table>
</div>
{template 'footer'}